<!doctype html>
<html>
  <head>
    <!-- Global site tag (gtag.js) - Google Analytics -->
    <script async src='https://www.googletagmanager.com/gtag/js?id=UA-132775238-1'></script>
    <script>
      window.dataLayer = window.dataLayer || [];
      function gtag(){dataLayer.push(arguments);}
      gtag('js', new Date());
      gtag('config', 'UA-132775238-1');
    </script>
    <meta charset='utf-8'>
    <meta name='viewport' content='width=device-width, minimum-scale=1, initial-scale=1, user-scalable=yes'>
    <link href="https://fonts.googleapis.com/css2?family=Open+Sans:wght@300;600&family=Roboto+Mono&display=swap" rel="stylesheet">
    <style>
      .btn {
        width: 90px;
        height: 32px;
        font-size:13px;
        background-color: #47AFE8;
        color: #fff;
        border: none;
        margin: 0 2px;
        border-radius: 2px;
        cursor:pointer;
        outline:none;
      }
      .txt{
        width: 100px;
        height: 30px;
        font-size:13px;
        background-color: #333;
        border: 1px solid #47AFE8;
        color: #fff;
        padding:0 8px;
        margin: 0 2px;
        border-radius: 2px;
        outline:none;
      }
      rapi-doc{
        width:100%;
      }
    </style>
    <script type='text/javascript' src='../rapidoc-min.js'></script>
    <script>
      function setApiKey(){
        const docEl = document.getElementById('thedoc');
        const keyInputEl = document.getElementById('key-val-input');

        docEl.setAttribute('api-key-name','api_key');
        docEl.setAttribute('api-key-location','header');
        docEl.setAttribute('api-key-value', keyInputEl.value);
        if (keyInputEl.value.trim()) {
          document.getElementById('header-msg').innerHTML = "<span style='color:lime'>Auth Key Applied</span>";
        } else {
          document.getElementById('header-msg').innerHTML = "<span style='color:orangered'>Removed Key</span>"
        }
      }
    </script>
  </head>
  <body>
    <rapi-doc id='thedoc' 
      spec-url='../specs/api-key.yaml'
      allow-authentication = "false"
      regular-font = "Open Sans"
      mono-font = "Roboto Mono"
      allow-spec-file-load = "false"
      api-key-name = "api_key"
      api-key-location = "header"
      api-key-value = "-"
      render-style="read"
    > 
      <div slot='header' > 
        <input class='txt' id='key-val-input' type='text' placeholder='API Key' value='special-key' spellcheck='false' >
        <button class='btn' onclick='setApiKey()'>SET KEY</button>
        <span id="header-msg"></span>
      </div>
    </rapi-doc>
  </body>
</html>